package Databasehandler;
import java.sql.ResultSet;
import java.util.GregorianCalendar;

/**
 * Et interface der beskriver hvilke funktioner der skal være tilgængelige i et DBCommunicator-objekt
 *
 * @author Daniel Koch
 */
public interface DBCommunicator {

    //<editor-fold desc="Kunde">

    /**
     * Opretter en kunde.
     *
     * @param customerName
     * @throws Exception
     */
    void createCustomer(String customerName) throws Exception;

    /**
     * Redigérer en kunde.
     *
     * @param customerID
     * @param customerName
     * @throws Exception
     */
    void editCustomer(int customerID, String customerName) throws Exception;

    /**
     * Sletter en kunde.
     *
     * @param customerID
     * @throws Exception
     */
    void deleteCustomer(int customerID) throws Exception;

    /**
     * Henter en kunde.
     *
     * @param customerID
     * @return Et ResultSet-objekt med én kunde.
     * @throws Exception
     */
    ResultSet getCustomer(int customerID) throws Exception;

    /** Henter alle kunder.
     *
     * @return Et ResultSet-objekt med alle kunder.
     * @throws Exception
     */
    ResultSet getCustomers() throws Exception;

    /**
     * Henter alle aktuelle kunder.
     *
     * @return Et ResultSet-objekt med alle aktuelle kunder
     * @throws Exception
     */
    ResultSet getCurrentCustomers() throws Exception;

    //</editor-fold>

    //<editor-fold desc="Batchrapportsystem">

    /**
     * Opretter et batchrapportsystem.
     *
     * @param batchReportSystemName
     * @param batchReportIntervalID
     * @param customerID
     * @throws Exception
     */
    void createBatchReportSystem(String batchReportSystemName, int batchReportIntervalID, int customerID) throws Exception;

    /**
     * Redigérer et batchrapportsystem.
     *
     * @param batchReportSystemID
     * @param batchReportSystemName
     * @param batchReportIntervalID
     * @throws Exception
     */
    void editBatchReportSystem(int batchReportSystemID, String batchReportSystemName, int batchReportIntervalID) throws Exception;

    /**
     * Sletter et batchrapportsystem.
     *
     * @param batchSystemID
     * @throws Exception
     */
    void deleteBatchReportSystem(int batchSystemID) throws Exception;

    /**
     * Henter et batchrapportsystem.
     *
     * @param batchSystemID
     * @return Et ResultSet-objekt med ét batchrapportsystem
     * @throws Exception
     */
    ResultSet getBatchReportSystem(int batchSystemID) throws Exception;

    /**
     * Henter alle batchrapportsystemer.
     *
     * @return Et ResultSet-objekt med alle batchrapportsystemer
     * @throws Exception
     */
    ResultSet getBatchReportSystems() throws Exception;

    /**
     * Henter ét batchrapportsystemid.
     *
     * @return Et int objekt for det søgte batchrapportnavn
     * @throws Exception
     */
    int getBatchReportSystemID(String batchReportName) throws Exception;

     /**
      * Henter alle batchrapportsystemer for en kunde.
      *
      * @param customerID
      * @return Et ResultSet-objekt med alle batchrapportsystemer for en kunde.
      * @throws Exception
      */
    ResultSet getCustomerBatchReportSystems(int customerID) throws Exception;

    /**
     * Henter alle aktuelle batchrapportsystmer.
     *
     * @return Et ResultSet-objekt med alle aktuelle batchrapportsystemer.
     * @throws Exception
     */
    ResultSet getCurrentBatchReportSystems() throws Exception;

    /**
     * Henter alle aktuelle batchrapportsystemer for en kunde.
     *
     * @param customerID
     * @return Et ResultSet-objekt med alle aktuelle batchrapportsystemer for en kunde.
     * @throws Exception
     */
    ResultSet getCurrentCustomerBatchReportSystems(int customerID) throws Exception;

    //</editor-fold>

    //<editor-fold desc="Abonnent">

    /**
     * Opretter en abonnent.
     *
     * @param subscriberName
     * @param customerID
     * @param email
     * @throws Exception
     */
    void createOBSReportSubscriber(String subscriberName, int customerID, String email) throws Exception;

    /**
     * Redigérer en abonnent.
     *
     * @param subscriberID
     * @param subscriberName
     * @param email
     * @throws Exception
     */
    void editOBSReportSubscriber(int subscriberID, String subscriberName, String email) throws Exception;

    /**
     * Sletter en abonnent.
     *
     * @param subscriberID
     * @throws Exception
     */
    void deleteOBSReportSubscriber(int subscriberID) throws Exception;

    /**
     * Henter en abonnent.
     *
     * @param subscriberID
     * @return Et ResultSet-objekt med én abonnent
     * @throws Exception
     */
    ResultSet getOBSReportSubscriber(int subscriberID) throws Exception;
    
    /**
     * Henter alle abonnenter.
     *
     * @return Et ResultSet-objekt med alle abonnenter.
     * @throws Exception
     */
    ResultSet getOBSReportSubscribers() throws Exception;

    /**
     * Henter alle abonnenter for en kunde.
     *
     * @param customerID
     * @return Et ResultSet-objekt med alle abonnenter for en kunde.
     * @throws Exception
     */
    ResultSet getCustomerOBSReportSubscribers(int customerID) throws Exception;

    /**
     * Henter alle aktuelle abonnenter for en kunde.
     * @param customerID
     * @return Et ResultSet-objekt med alle aktuelle abonnenter for en kunde.
     * @throws Exception
     */
    ResultSet getCurrentCustomerOBSReportSubscribers(int customerID) throws Exception;

    //</editor-fold>

    //<editor-fold desc="Abonnement">

    /**
     * Opretter et abonnement.
     *
     * @param batchReportSystemID
     * @param OBSReportSubscriberID
     * @throws Exception
     */
    void createOBSReportSubscription(int batchReportSystemID, int OBSReportSubscriberID) throws Exception;

    /**
     * Sletter et abonnement.
     *
     * @param OBSReportSubscriptionID
     * @throws Exception
     */
    void deleteOBSReportSubscription(int OBSReportSubscriptionID) throws Exception;

    /**
     * Henter et abonnement.
     *
     * @param OBSReportSubscriptionID
     * @return Et ResultSet-objekt med ét abonnement.
     * @throws Exception
     */
    ResultSet getOBSReportSubscription(int OBSReportSubscriptionID) throws Exception;

    /**
     * Henter alle abonnementer for en abonnent.
     *
     * @param OBSReportSubscriberID
     * @return Et ResultSet-objekt med alle abonnementer for en abonnent.
     * @throws Exception
     */
    ResultSet getOBSReportSubscriberOBSReportSubscriptions(int OBSReportSubscriberID) throws Exception;

    /**
     * Henter alle aktuelle abonnementer for en abonnent.
     *
     * @param OBSReportSubscriberID
     * @return Et ResultSet-objekt med alle aktuelle abonnementer for en abonnent,
     * @throws Exception
     */
    ResultSet getCurrentOBSReportSubscriberOBSReportSubscriptions(int OBSReportSubscriberID) throws Exception;

    //</editor-fold>

    //<editor-fold desc="Batchrapporter">

    /**
     * Opretter en batchrapport.
     *
     * @param batchReportSystemID
     * @param batchReportName
     * @param batchStartTime
     * @param batchEndTime
     * @param success
     * @param statusMessage
     * @throws Exception
     */
    void createBatchReport(int batchReportSystemID, String batchReportName, String batchStartTime, String batchEndTime, Boolean success, String statusMessage) throws Exception;

    /**
     * Henter en batchrapport.
     *
     * @param batchReportID
     * @return Et ResultSet-objekt med én batchrapport.
     * @throws Exception
     */
    ResultSet getBatchReport(int batchReportID) throws Exception;

    /**
     * Opretter et detaljesæt.
     *
     * @param batchReportID
     * @param detailSetName
     * @param totalUpdates
     * @param totalCreates
     * @param totalDeletes
     * @param totalErrors
     * @param totalSkips
     * @throws Exception
     */
    void createBatchReportDetailSet(int batchReportID, String detailSetName, int totalUpdates, int totalCreates, int totalDeletes, int totalErrors, int totalSkips) throws Exception;

    /**
     * Henter et detaljesæt.
     *
     * @param batchReportDetailSetID
     * @return Et ResultSet-objekt med ét detaljesæt.
     * @throws Exception
     */
    ResultSet getBatchReportDetailSet(int batchReportDetailSetID) throws Exception;

    /**
     * Henter alle detaljesæt for en batchrapport.
     *
     * @param batchReportID
     * @return Et ResultSet-objekt med alle detaljesæt for en batchrapport.
     * @throws Exception
     */
    ResultSet getBatchReportDetailSets(int batchReportID) throws Exception;

    /**
     * Sletter en batchrapport.
     *
     * @param batchReportID
     * @throws Exception
     */
    void deleteBatchReport(int batchReportID) throws Exception;

    /**
     * Henter alle batchrapporter for et batchrapportsystem.
     * @param batchReportSystemID
     * @return Et ResultSet-objekt med alle batchrapporter for et batchrapportsystem.
     * @throws Exception
     */
    ResultSet getBatchReportSystemBatchReports(int batchReportSystemID) throws Exception;

    /**
     * Henter alle aktuelle batchrapporter for et batchrapportsystem.
     *
     * @param batchReportSystemID
     * @return Et ResultSet-objekt med alle aktuelle batchrapporter for et batchrapportsystem.
     * @throws Exception
     */
    ResultSet getCurrentBatchReportSystemBatchReports(int batchReportSystemID) throws Exception;

    //</editor-fold>

    //<editor-fold desc="Andet">

    /**
     * Henter alle aktuelle uafsendte batchrapporter.
     *
     * @return Et ResultSet-objekt med alle aktuelle uafsendte batchrapporter.
     * @throws Exception
     */
    ResultSet getBatchReportCurrentUnsent() throws Exception;
    
    /**
     * Henter et batchrapportinterval.
     *
     * @param batchReportIntervalID
     * @return Et ResultSet-objekt med ét batchrapportinterval
     * @throws Exception
     */
    ResultSet getBatchReportInterval(int batchReportIntervalID) throws Exception;

    /**
     * Henter alle batchrapportintervaller.
     *
     * @return Et ResultSet-objekt med alle batchrapportintervaller.
     * @throws Exception
     */
    ResultSet getBatchReportIntervals() throws Exception;

    /**
     * Registrerer status vedrørende afsendelse af batchrapporter.
     *
     * @param OBSReportSubscriberID
     * @param statusMessage
     * @param BatchReportID
     * @throws Exception
     */
    void  registerInSendLog (int OBSReportSubscriberID, String statusMessage, int BatchReportID) throws Exception;

    //</editor-fold>
}
